package com.qf.air.config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author 10537
 * @version V1.0
 * @Date 2021/11/9 20:29
 */
@Configuration
public class RabbitMQConfig {

    public static final String AIR_EXCHANGE="air_exchange";
    public static final String AIR_QUEUE="air_queue";
    public static final String AIR_ROUTINGKEY="air.#";

    @Bean
    public Exchange airExchange(){
        return ExchangeBuilder.topicExchange(AIR_EXCHANGE).build();
    }

    @Bean
    public Queue airQueue(){
        return QueueBuilder.durable(AIR_QUEUE).build();
    }

    @Bean
    public Binding airBingding(Exchange airExchange,Queue airQueue){
        return BindingBuilder.bind(airQueue).to(airExchange).with(AIR_ROUTINGKEY).noargs();
    }
}
